package com.mew.auc.controller;

import com.alibaba.fastjson.JSON;
import com.mew.auc.annotation.AseEncrypt;
import com.mew.auc.service.ConfigInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class ConfigInfoController {
    @Autowired
    private ConfigInfoService configInfoService;

    @GetMapping(value = "/get/errorcode")
    @ResponseBody
    @AseEncrypt
    public String getErrorCode(){
        return JSON.toJSONString(configInfoService.errorCode());
    }

    @GetMapping(value = "/get/config")
    @ResponseBody
    @AseEncrypt
    public String getConfigInfo(){
        try {
            return JSON.toJSONString(configInfoService.configInfo());
        }catch (Exception e){
            log.error("config", e);
            return null;
        }
    }
}
